home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / nihcl-30.lha / nihcl-3.0 / lib / SortedCltn.h < prev    next >
C/C++ Source or Header  |  1990-05-19  |  2KB  |  62 lines

  1. #ifndef    SORTEDCLTN_H
  2. #define    SORTEDCLTN_H
  3.  
  4. /*$Header: /afs/alw.nih.gov/unix/sun4_40c/usr/local/src/nihcl-3.0/share/lib/RCS/SortedCltn.h,v 3.0 90/05/20 00:21:26 kgorlen Rel $*/
  5.  
  6. /* SortedCltn.h -- declarations for sorted collection
  7.  
  8.     THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
  9.     "UNITED STATES GOVERNMENT WORK".  IT WAS WRITTEN AS A PART OF THE
  10.     AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE.  THIS MEANS IT
  11.     CANNOT BE COPYRIGHTED.  THIS SOFTWARE IS FREELY AVAILABLE TO THE
  12.     PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
  13.     RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
  14.  
  15. Author:
  16.     K. E. Gorlen
  17.     Computer Systems Laboratory, DCRT
  18.     National Institutes of Health
  19.     Bethesda, MD 20892
  20.  
  21. $Log:    SortedCltn.h,v $
  22.  * Revision 3.0  90/05/20  00:21:26  kgorlen
  23.  * Release for 1st edition.
  24.  * 
  25. */
  26.  
  27. #include "OrderedCltn.h"
  28. #include "Range.h"
  29.  
  30. class SortedCltn: public OrderedCltn {
  31.     DECLARE_MEMBERS(SortedCltn);
  32. #ifndef BUG_38
  33. // internal <<AT&T C++ Translator 2.00 06/30/89>> error: bus error (or something nasty like that)
  34. protected:        // storer() functions for object I/O
  35.     virtual    void storer(OIOofd& fd)    const    { OrderedCltn::storer(fd); };
  36.     virtual    void storer(OIOout& strm) const    { OrderedCltn::storer(strm); };
  37. #endif
  38. public:
  39.     SortedCltn(unsigned size =DEFAULT_CAPACITY);
  40.     bool operator!=(const SortedCltn& a) const    { return !(*this==a); }
  41.     void operator=(const SortedCltn&);
  42.     virtual Object* add(Object&);
  43.     int findIndexOf(const Object& key) const;
  44.     virtual unsigned occurrencesOf(const Object&) const;
  45.     Range findRangeOf(const Object& key) const;
  46.     Object* remove(const Object&);
  47. protected:
  48.     int findIndexOfFirstKey(const Object&, const int) const;
  49.     int findIndexOfLastKey(const Object&, const int) const;
  50. private:                // shouldNotImplement()
  51.     virtual Object* addAfter(const Object& ob, Object& newob);
  52.     virtual Object* addAllLast(const OrderedCltn&);
  53.     virtual Object* addBefore(const Object& ob, Object& newob);
  54.     virtual Object* addLast(Object& ob);
  55.     virtual void atAllPut(Object& ob);
  56.     virtual int indexOfSubCollection(const SeqCltn& cltn, int start=0) const;
  57.     virtual void replaceFrom(int start, int stop, const SeqCltn& replacement, int startAt =0);
  58.     virtual void sort();
  59. };
  60.  
  61. #endif
  62.